/*
 * @Description: protocol buffer definiation
 * @Author: Carlton
 * @Date: 2019-09-03 16:34:26
 * @LastEditTime: 2021-01-20 18:04:11
 * @LastEditors: select last editor
 */


#ifndef PBD_H__
#define PBD_H__

#include <stdint.h>


typedef enum{
    PBD_COMMAND_DFU_INIT    = 0x01,
    PBD_COMMAND_DFU_WRITE   = 0x02,
    PBD_COMMAND_DFU_EXECUTE = 0x03,
    PBD_COMMAND_DFU_QUERY   = 0x0C,
    PBD_COMMAND_DFU_RESET   = 0x0D,
    PBD_COMMAND_DFU_MTU     = 0x0E,
    PBD_COMMAND_DFU_VERSION = 0x0F,

    PBD_COMMAND_PROFILE = 0x10,
    PBD_COMMAND_APPLICATION, 
    PBD_COMMAND_CONTROL,
    PBD_COMMAND_MEMORY, 
    PBD_COMMAND_RECORD, 
    PBD_COMMAND_RESOURCE, 
    
    PBD_COMMAND_DOWNLOAD,
    PBD_COMMAND_UPLOAD, 

    PBD_COMMAND_BT_MODULE = 0x20, 

    PBD_COMMAND_NEGATIVE = 0x7F,

    PBD_COMMAND_SYSTEM = 0xFE,
    PBD_COMMAND_FACTORY_TEST = 0xFF, 
}pbd_command_t; 

typedef enum{
    PBD_DFU_INIT_KEY_SIZE = 0,
}pbd_dfu_init_key_t; 
typedef enum{
    PBD_DFU_WRITE_KEY_OFFSSET = 1,
    PBD_DFU_WRITE_KEY_CONTETN, 
}pbd_dfu_write_key_t;
typedef enum{
    PBD_DFU_EXECUTE_KEY_RES = 1,
}pbd_dfu_execute_key_t;
typedef enum{
    PBD_DFU_QUERY_KEY_STATE = 1,
}pbd_dfu_query_key_t; 
typedef enum{
    PBD_DFU_INFO_KEY_MTU = 1,
    PBD_DFU_INFO_KEY_VERSION,
}pbd_dfu_info_key_t;
typedef enum{
    PBD_DFU_RESET_KEY = 1
}pbd_dfu_reset_key_t; 


typedef enum{
    PBD_PROFILE_KEY_SYS_INFO = 0x01,
    PBD_PROFILE_KEY_FIRMWARE_VERSION,
    PBD_PROFILE_KEY_PROJECT_CODE,
    PBD_PROFILE_KEY_MAC,
    PBD_PROFILE_KEY_DEVICE_ID, 
    PBD_PROFILE_KEY_MTU, // Max transmit unit supported by this device 
    PBD_PROFILE_KEY_SERIAL_NO, 
    PBD_PROFILE_KEY_LOGO, 

    PBD_PROFILE_KEY_GENDER = 0x10,
    PBD_PROFILE_KEY_AGE,
    PBD_PROFILE_KEY_HEIGHT,
    PBD_PROFILE_KEY_WEIGHT,
    PBD_PROFILE_KEY_SKIN,

    PBD_PROFILE_KEY_FATIGUE_REMINDER = 0x30,
    PBD_PROFILE_KEY_DO_NOT_DISTURB,
    PBD_PROFILE_KEY_TARGET_OF_DAY,
    PBD_PROFILE_KEY_TARGET_OF_WEEK,
    PBD_PROFILE_KEY_PROXIMITY_ALERT,
    PBD_PROFILE_KEY_NOTIFICATION_CATEGORY,
    PBD_RPOFILE_KEY_NOTIFICATION_APPLICATION,
    PBD_PROFILE_KEY_HERATRATE,
    PBD_PROFILE_KEY_BLOODPRESSURE,
    PBD_PROFILE_KEY_TEMPERATURE, 
	PBD_PROFILE_KEY_BLOODOXYGEN,
    PBD_PROFILE_KEY_DRINK_REMINDER,
    PBD_PROFILE_KEY_SLEEP_OPTION,

    PBD_PROFILE_KEY_BT_SETTING = 0x70,
    
    PBD_PROFILE_KEY_LANGUAGE = 0xC0,
    PBD_PROFILE_KEY_TIME_FORMAT,
    PBD_PROFILE_KEY_UNIT,
    PBD_PROFILE_KEY_SMART_LIGHT_ON,
    PBD_PROFILE_KEY_TIME_OF_LIGHT_ON,
    PBD_PROFILE_KEY_BRIGHTNESS, 
    PBD_PROFILE_KEY_WEARING_HABIT,
    PBD_PROFILE_KEY_WATCHFACE, 

	PBD_PROFILE_KEY_PAIRED,
    PBD_PROFILE_KEY_VIEW_STYLE,
    PBD_PROFILE_KEY_MOTOR_LEVEL, 
    PBD_PROFILE_READ = 0xFE,
    PBD_PROFILE_SAVE = 0xFF 
}pbd_profile_key_t;

typedef enum{
    PBD_APPLICATION_KEY_ALARM_CLOCK_1 = 0x01, 
    PBD_APPLICATION_KEY_ALARM_CLOCK_2,
    PBD_APPLICATION_KEY_ALARM_CLOCK_3,
    PBD_APPLICATION_KEY_ALARM_CLOCK_4, 

    PBD_APPLICATION_KEY_TODO_TASK_1 = 0x10, 
    PBD_APPLICATION_KEY_TODO_TASK_2,
    PBD_APPLICATION_KEY_TODO_TASK_3,
    PBD_APPLICATION_KEY_TODO_TASK_4, 

    PBD_APPLICATION_KEY_SCHEDULE_TASK_1 = 0x20,
    PBD_APPLICATION_KEY_SCHEDULE_TASK_2,
    PBD_APPLICATION_KEY_SCHEDULE_TASK_3,
    PBD_APPLICATION_KEY_SCHEDULE_TASK_4,

    PBD_APPLICATION_KEY_PHYSIC_PERIOD = 0x30, 
}pbd_application_key_t; 

typedef enum{
	PBD_CONTROL_KEY_BASE = 0,

    PBD_CONTROL_KEY_SET_DATETIME = 1,
    PBD_CONTROL_KEY_GET_DATETIME,
    PBD_CONTROL_KEY_SET_DAY_OF_WEEK,
    PBD_CONTROL_KEY_GET_DAY_OF_WEEK,
    PBD_CONTROL_KEY_BATTERY_STATUS, 
    PBD_CONTROL_KEY_GET_LCD_TIMEON, 

    PBD_CONTROL_KEY_HR_SETUP_MEASURE = 0x10,
    PBD_CONTROL_KEY_HR_RESULT,
    PBD_CONTROL_KEY_BP_SETUP_MEASURE,
    PBD_CONTROL_KEY_BP_RESULT,
    PBD_CONTROL_KEY_TEMP_SETUP_MEASURE,
    PBD_CONTROL_KEY_TEMP_RESULT, 
    PBD_CONTROL_KEY_SPO2_SETUP_MEASURE,
    PBD_CONTROL_KEY_SPO2_RESULT,


    PBD_CONTROL_KEY_INCOMING_CALL = 0x40,
    PBD_CONTROL_KEY_INCOMING_CALL_REMOVE,
    PBD_CONTROL_KEY_INCOMING_CALL_HANDLE, 
    PBD_CONTROL_KEY_MISSED_CALL,

    PBD_CONTROL_KEY_NOTIFICATION_APP = 0x50,
    PBD_CONTROL_KEY_NOTIFICATION_DATE,
    PBD_CONTROL_KEY_NOTIFICATION_TITLE,
    PBD_CONTROL_KEY_NOTIFICATION_MESSAGE, 
    PBD_CONTROL_KEY_NOTIFICATION_MESSAGE_SEGMENT, 
    PBD_CONTROL_KEY_NOTIFICATION_MESSAGE_RESP,
    
    PBD_CONTROL_KEY_CAMERA = 0x80,
    PBD_CONTROL_KEY_MUSIC,
    PBD_CONTROL_KEY_FINDME = 0x83,
    PBD_CONTROL_KEY_WEAR_DET,
    PBD_CONTROL_KEY_SOS,

    PBD_CONTROL_KEY_EMS_OP = 0xE0,
    PBD_CONTROL_KEY_HEAT_OP,  // HEAT is aux function for EMS
    PBD_CONTROL_KEY_STATUS_OF_EMS, // read of notify 
}pbd_control_key_t; 

typedef enum{
	PBD_MEMORY_KEY_BASE = 0,

    PBD_MEMORY_KEY_WRITE_INNER,
    PBD_MEMORY_KEY_READ_INNER, 

    PBD_MEMORY_KEY_EXT_FLASH_READ_DEV_ID = 0x10,
    PBD_MEMORY_KEY_EXT_FLASH_READ_JEDEC_ID,
    PBD_MEMORY_KEY_EXT_FLASH_READ_DATA,
    PBD_MEMORY_KEY_EXT_FLASH_WRITE_DATA ,
    PBD_MEMORY_KEY_EXT_FLASH_ERASE_BLOCK,
    PBD_MEMORY_KEY_EXT_FLASH_ERASE_SECTOR,
    
    PBD_MEMORY_KEY_ACCEL_READ_REG = 0x20,
    PBD_MEMORY_KEY_ACCEL_WRITE_REG,
    PBD_MEMORY_KEY_ACCEL_READ_DATA,
    PBD_MEMORY_KEY_ACCEL_WRITE_DATA, 
    PBD_MEMORY_KEY_ACCEL_FIFO_DATA, 
    

    PBD_MEMORY_KEY_TP_DATA = 0x30, 

    PBD_MEMORY_KEY_HRS_READ_REG = 0x40,
    PBD_MEMORY_KEY_HRS_WRITE_REG,
    PBD_MEMORY_KEY_HRS_READ_DATA,
    PBD_MEMORY_KEY_HRS_WRITE_DATA,
    PBD_MEMORY_KEY_HRS_FIFO_DATA, 

    PBD_MEMORY_KEY_ECG_READ_REG = 0x50,
    PBD_MEMORY_KEY_ECG_WRITE_REG,
    PBD_MEMORY_KEY_ECG_READ_DATA,
    PBD_MEMORY_KEY_ECG_WRITE_DATA, 
    PBD_MEMORY_KEY_ECG_FIFO_DATA, 

    PBD_MEMORY_KEY_I2C_READ_DATA = 0x80, // set i2c read data 
    PBD_MEMORY_KEY_I2C_WRITE_DATA, 
}pbd_memory_key_t;

typedef enum{    
    PBD_RECORD_KEY_STEP_OF_DAY = 1,
    PBD_RECORD_KEY_SLEEP_OF_DAY,
    PBD_RECORD_KEY_STEP,
    PBD_RECORD_KEY_ACTIVITY_OF_DAY,
    PBD_RECORD_KEY_STATIC,
    PBD_RECORD_KEY_HEART_RATE,

    PBD_RECORD_KEY_QUERY = 0xF0,
    PBD_RECORD_KEY_RECORD_SIZE,
    PBD_RECORD_KEY_CREATE_SESSION,
    PBD_RECORD_KEY_PACKET_UPLOAD, 
    PBD_RECORD_KEY_PACKET_ACK, 
    PBD_RECORD_KEY_STOP_SESSION, 
}pbd_record_key_t; 

typedef enum{
    PBD_BTM_KEY_POWER_OFF = 0,
    PBD_BTM_KEY_POWER_ON,
    PBD_BTM_KEY_OPEN_BLUETOOTH,
    PBD_BTM_KEY_CLOSE_BLUETOOTH,
    PBD_BTM_KEY_OPEN_UART,
    PBD_BTM_KEY_CLOSE_UART,
    PBD_BTM_KEY_RESET,
    PBD_BTM_KEY_OPEN_BLE,
    PBD_BTM_KEY_CLOSE_BLE,    
    
    
    PBD_BTM_KEY_GET_INFO = 0x10,
    PBD_BTM_KEY_GET_VERSION,
    PBD_BTM_KEY_GET_BT_MAC,
    PBD_BTM_KEY_GET_VOL,
    PBD_BTM_KEY_SET_HF_VOL,
    PBD_BTM_KEY_SET_AD_VOL,

    PBD_BTM_KEY_DIALING = 0x20, 
    PBD_BTM_KEY_HANG_UP,
    PBD_BTM_KEY_ANSWER,
    PBD_BTM_KEY_REDIALING,

    PBD_BTM_KEY_PMUSIC_PLAY = 0x30,
    PBD_BTM_KEY_PMUSIC_PAUSE,
    PBD_BTM_KEY_PMUSIC_NEXT_TRACK,
    PBD_BTM_KEY_PMUSIC_PREVIOUS_TRACK,

    PBD_BTM_KEY_PBAP_START = 0x40,
    PBD_BTM_KEY_PBAP_CANCEL, 


    PBD_BTM_KEY_QUERY_STATE = 0x50,
    PBD_BTM_KEY_CONNECT_TO,
    PBD_BTM_KEY_CONNECT_LAST,
    PBD_BTM_KEY_BT_DISCONNECT,
    PBD_BTM_KEY_BT_PAIR, 
    PBD_BTM_KEY_BT_RESET, 
    PBD_BTM_KEY_TOGGLE_BT, 
    

    PBD_BTM_KEY_OPEN_MIC_LOOP = 0xF0,
    PBD_BTM_KEY_CLOSE_MIC_LOOP,
}pbd_btm_key_t;

typedef enum{
	PBD_SYSTEM_KEY_BASE = 0,
    PBD_SYSTEM_KEY_POWER_OFF,
    PBD_SYSTEM_KEY_DEVICE_RESET,
    PBD_SYSTEM_KEY_ENTER_DFU,
    PBD_SYSTEM_KEY_ENTER_TPDFU, 
    PBD_SYSTEM_KEY_ENTER_ULP,     

    PBD_SYSTEM_KEY_FACTORY_RESET= 0x10,
    PBD_SYSTEM_KEY_REMOVE_HISTORY_DATA,
    PBD_SYSTEM_KEY_RESET_PROFILE, 

    PBD_SYSTEM_KEY_MANUAL_MODE = 0xFE, 
}pbd_system_key_t; 

typedef enum{
	PBD_FACTORY_KEY_BASE = 0,
    PBD_FACTORY_KEY_ENTER,
    PBD_FACTORY_KEY_EXIT,

    PBD_FACTORY_KEY_BUTTON = 0x10,
    PBD_FACTORY_KEY_LED,
    PBD_FACTORY_KEY_SEGLED,
    PBD_FACTORY_KEY_VIBRATE,
    PBD_FACTORY_KEY_BEEPER,
    PBD_FACTORY_KEY_DISPLAY,

    PBD_FACTORY_KEY_ACCELERATOR = 0x30,
    PBD_FACTORY_KEY_TP,
    PBD_FACTORY_KEY_FLASH,
    PBD_FACTORY_KEY_HEARTRATE, 

    PBD_FACTORY_KEY_LCD_CALIBRATE = 0x60,

    PBD_FACTORY_KEY_ALERT = 0x80,
    PBD_FACTORY_KEY_TEXT, 

    PBD_FACTORY_KEY_SELFTEST_QUERY_STATE = 0xC0,
    PBD_FACTORY_KEY_SELFTEST_QUERY_RESULT,
}pbd_factory_test_key_t; 

#endif 
